require("../../assets/css/index.less");
require("./my.less");
require("../../assets/fonts/iconfont.css");
const axios = require("axios");
require('../../utils/https');
const { footer } = require("../../utils/dom");
const dom = require("../../utils/dom");
axios.defaults.headers.common['Authorization'] = JSON.parse(localStorage.getItem("token"));

function $(a) {
    return document.querySelector(a);
};

async function fn() {
    const res = await axios.get("/api/user/info")
    console.log(res.data.data);
    $("#img").src = res.data.data.imgUrl;
    $("#name").textContent = res.data.data.nickName;
    $("#textarea").textContent = res.data.data.sign;
    $(".Clock_In .num").textContent = res.data.data.circlesCount;
    localStorage.setItem("user", JSON.stringify({
        nickName: res.data.data.nickName,
        gender: res.data.data.gender,
        birthday: res.data.data.birthday,
        imgUrl: res.data.data.imgUrl,
        provinceId: res.data.data.provinceId,
        cityId: res.data.data.cityId,
        sign: res.data.data.sign,
    }))
}
fn()

$(".arrows").addEventListener("click", () => {
    console.log(1);
    location.href = "/mydata.html";
});

$(".badge_arrows").addEventListener("click", () => {
        location.href = "/mybadge.html";
    })
    // 跳转到运动数据
dom.jump('#sportData', 'sportsData.html')

$(".user .icon-rightarrow").addEventListener("click", function() {
    location.href = "/circle.html";
});

footer("my");